﻿@model IPagination<Deposit>
@using BankCreditPortfolio.DAL.Entities
@using BankCreditPortfolio.Core.Helpers
@using MvcContrib.Pagination
@using MvcContrib.UI.Grid
@using MvcContrib.UI.Pager
@{
    ViewBag.Title = "Deposits";
}
<strong>State Of Deposits</strong>
<p>
    Here you can see the list of bank and client deposits. </p>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/Styles/forms.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/Styles/customgrid.css")" rel="stylesheet" type="text/css" />

<div class="anch">
@Html.ActionLink("Bank deposits", "Deposits", new { depType = "bank" }/*, new { @class = "anch" }*/)
@Html.ActionLink("Client deposits", "Deposits", new { depType = "client" }/*, new { @class = "anch" }*/)
</div>

@using (Html.BeginForm())
{
    var depType = Request["depType"];
    <div>
        @{
    if (Model.Count() != 0)
    {
        var grid = Html.Grid(Model).Columns(column =>
        {
            if (depType != null && depType.Equals("client"))
                column.For(x => AccountHelper.GetUsername(x.Account.Email)).Named("Client");
            column.For(x => x.Currency.Title).Named("Currency");
            column.For(x => x.Amount).Named("Amount");
        });
        grid.Render();
        <br />
        @Html.Pager(Model).First("First").Last("Last").Next("Next").Previous("Previous")
    }
    else
    {
            <div>
                There is no bank deposits.</div>
    }
        }
    </div>
}
